#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
check_change()
{
	static struct stat sb;
	struct stat tsb;

	if (sb.st_mtime == 0) {
		if (stat("/var/log/banssh/lock/bansshcpp", &sb) == -1) {
			perror("stat");
			return -1;
		}
		return 0;
	}

	if (stat("/var/log/banssh/lock/bansshcpp", &tsb) == -1) {
		perror("stat");
		return -1;

	}

	if (sb.st_mtime != tsb.st_mtime) {
		return 1;

	}

	else {
		return 0;
	}

}

int
main(int argc, char *argv[])
{

	while (1) {

		if (check_change() == 1)
			fprintf(stderr, "changed\n");
		else
			fprintf(stderr, "No change\n");
		sleep(3);
	}

	exit(EXIT_SUCCESS);
}
